package com.kgc.est.controller;

import com.kgc.est.feignService.MaintainOrderService;
import com.kgc.est.request.AppointmentReq;
import com.kgc.est.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
@Api("订单详情接口")
@RestController
@RequestMapping("/api/order/maintain")
public class MaintainOrderController {

    @Autowired(required = false)
    private MaintainOrderService maintainOrderService;

    Logger log = LoggerFactory.getLogger(MaintainOrderController.class);

    @ApiOperation(value = "生成订单和预约以及订单流水接口")
    @PostMapping("/submit")
    public Result submit(AppointmentReq appointmentReq, HttpServletRequest request){
        log.info("appointmentReq：{}",appointmentReq);

        //获取token
        String token = request.getHeader("token");
        appointmentReq.setToken(token);

        return maintainOrderService.submit(appointmentReq);
    }

}
